﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Configuration;
using System.Data.SqlClient;
using SmartMosaicServer.Upload;
using SmartMosaicServer;


public partial class photowrite : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void btn_submit_Click(object sender, ImageClickEventArgs e)
    {
        // 파일 업로드 시도
        // DeepZoom 생성 완료시까지 대기
        FileUploader fileUploader = new FileUploader();
        //string deepZoomUrl = fileUploader.ImageUpload2(DeepZoomFileUpload, Convert.ToInt32(Theme.SelectedValue));

        string deepZoomUrl = "localhost";

        // DeepZoom 생성이 완료되면
        // Database에 해당 정보를 기록한다.
        SqlConnection connection = DbConn.GetConnection();

        string insertSql =
            "insert into DeepZoomList(WriterId, Subject, DeepZoomUrl, WriteTime, Content) values(@WriterId, @Subject, @DeepZoomUrl, @WriteTime, @Content)";

        SqlCommand cmd = new SqlCommand(insertSql, connection);

        cmd.Parameters.AddWithValue("@WriterId", User.Identity.Name);
        cmd.Parameters.AddWithValue("@Subject", Subject.Text);
        cmd.Parameters.AddWithValue("@DeepZoomUrl", deepZoomUrl);
        cmd.Parameters.AddWithValue("@WriteTime", DateTime.Now);
        cmd.Parameters.AddWithValue("@Content", Content.Text);

        cmd.Connection.Open();
        cmd.ExecuteNonQuery();
        cmd.Connection.Close();
    }
}
